<?php

class android_model extends CI_Model
{
	public function __construct()
    {
        $this->load->database();
    }

	//android登录模块
    public function get_user_by_android_username($username)
    {
        $query=$this->db->get_where('user',array('userName'=>$username));
        return $query->row_array();
        // return 1;
    }
    public function add_android_username($username,$password){
    	$data['userName'] = $username;
        $data['passwd'] = md5(md5(md5($password)));
        if ($this->is_exist($data['userName'])!=null)
        {
            return false;
        }
        else
        {
            $this->db->insert('user',$data);
            return true;
        }
    }
    public function is_exist($userName)
    {
        $query=$this->db->get_where('user',array('userName'=>$userName));
        return $query->row_array();
    }
}